package com.widget;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import android.os.Handler;
import android.util.Log;

public class InstallParser implements ParseStreaming {
	private int count;
	private int track = 0;
	//private Handler mMsgHandler;
	private Handler mContext;
	private String fullContent="";
	@Override
	public int parseString(String content) {
		//Pattern fstatus = Pattern.compile("Failure");
		//Matcher fstatusMatcher = fstatus.matcher(content);
		//Pattern sstatus = Pattern.compile("Success");
		//Matcher sstatusMatcher = fstatus.matcher(content);
		Log.d("INSTALL", content);
		if(content.contains("Failure")){
			mContext.sendEmptyMessage(INSTALLFAIL);
			return 0;
		}
		if(content.contains("Success")){
			mContext.sendEmptyMessage(INSTALLSUCC);
			return 0;
		}
		return 1;
	}

	@Override
	public void endMatcher(int n, Handler c) {
		count=n;
		mContext =  c;

	}

}
